package com.theatre.userservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.theatre.userservice.model.entity.Menu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MenuMapper extends BaseMapper<Menu> {
    @Select("""
        SELECT m.*
        FROM menus m
        JOIN role_menus rm ON m.id = rm.menu_id
        WHERE rm.role_id = #{roleId}
        ORDER BY m.parent_id, m.id
        """)
    List<Menu> selectMenusByRoleId(Long roleId);
}
